<template>
  <template v-for="item in menuData">
    <el-sub-menu
      v-if="item.children && item.children.length > 0"
      :index="item.id"
    >
      <template #title>
        <el-icon>
          <Guide/>
        </el-icon>
        <span>{{ item.name }}</span>
      </template>
      <LeftSubMenu :menuData="item.children"></LeftSubMenu>
    </el-sub-menu>
    <el-sub-menu v-else-if="item.parent===1" :index="item.id">
      <template #title>
        <el-icon>
          <Guide/>
        </el-icon>
        <span>{{ item.name }}</span>
      </template>
    </el-sub-menu>
    <el-menu-item
      :key="item.id"
      v-else
      :index="item.id"
    >
      <template #title>
        <span>{{ item.name }}</span>
      </template>
    </el-menu-item>
  </template>
</template>

<script setup>
import LeftSubMenu from "./LeftSubMenu.vue";


defineProps({
  menuData: {
    type: Array,
    default: [],
  },
});


</script>
